package com.zwj.enums;



import com.zwj.dto.EnumResult;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum IsDeletedEnum {
    NO("0","否"),YES("1","是");

    private String key;
    private String value;
    IsDeletedEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public static String getEnumValue(String key) {
        IsDeletedEnum[] isDeletedEnums = IsDeletedEnum.values();
        for (IsDeletedEnum isDeletedEnum : isDeletedEnums) {
            if (isDeletedEnum.getKey().equals(key)) {
                return isDeletedEnum.getValue();
            }
        }
        return null;
    }
    public static List<EnumResult> getEnumList() {
        IsDeletedEnum[] isDeletedEnums = IsDeletedEnum.values();
        List<EnumResult> result = Stream.of(isDeletedEnums).map(
                entry -> new EnumResult(entry.getKey(), entry.getValue())).collect(Collectors.toList());
        return result;
    }
    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
